﻿using System;


namespace HuoTu.Common
{
    /// <summary>
    /// Encode编码
    /// </summary>
    public class SysEncode
    {
        /// <summary>
        /// url编码(考虑保留字)
        /// </summary>
        /// <param name="value">处理的字符串</param>
        /// <returns></returns>
        public static string UrlEncode(string value)
        {
            return Microsoft.JScript.GlobalObject.encodeURI(value);
        }
        /// <summary>
        /// url解码(考虑保留字)
        /// </summary>
        /// <param name="value">处理的字符串</param>
        /// <returns></returns>
        public static string UrlDecode(string value)
        {
            return Microsoft.JScript.GlobalObject.decodeURI(value);
        }
        /// <summary>
        /// url编码
        /// </summary>
        /// <param name="value">处理的字符串</param>
        /// <returns></returns>
        public static string UrlEncodeComponent(string value)
        {
            return Microsoft.JScript.GlobalObject.encodeURIComponent(value);
        }
        /// <summary>
        /// url解码
        /// </summary>
        /// <param name="value">处理的字符串</param>
        /// <returns></returns>
        public static string UrlDecodeComponent(string value)
        {
            return Microsoft.JScript.GlobalObject.decodeURIComponent(value);
        }
        /// <summary>
        /// js的escape编码
        /// </summary>
        /// <param name="value">处理的字符串</param>
        /// <returns></returns>
        public static string Escape(string value)
        {
            return Microsoft.JScript.GlobalObject.escape(value);
        }
        /// <summary>
        /// js的unescape解码
        /// </summary>
        /// <param name="value">处理的字符串</param>
        /// <returns></returns>
        public static string UnEscape(string value)
        {
            return Microsoft.JScript.GlobalObject.unescape(value);
        }
    }
}
